package com.yigerende.management.controller;

import com.yigerende.management.bean.CommonResult;
import com.yigerende.management.entity.UserInfo;
import com.yigerende.management.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "测试管理",tags = {"测试管理接口"})
@RestController
@RequestMapping("/test/demo")
@CrossOrigin//解决跨域
public class ManagementController {

    @Autowired
    private UserService userService;

    @GetMapping("/")
    public CommonResult getIndet(){
        return new CommonResult(200,"测试4");
    }

    @ApiOperation(value = "通过id查询人员数据")
    @GetMapping("/name")
    public CommonResult getUserName(String id){
        System.out.println(id);
        UserInfo userInfo = userService.getUserName(id);
        return new CommonResult(200,"成功获取", userInfo);
    }






}
